package org.vogelsk.blue.objects;

/**
 * Class for the Paddle, object representing the pad that the user controls 
 * @author dejan.dosic
 *
 */
public class Paddle extends GenericCreature {

	public static final int STANDARD_PADDLE_HEIGHT = 10; 
	public static final int STANDARD_PADDLE_WIDTH = 86; 
	public static final int OFFSET_BALL_PADDLE =40;
	
	private Ball ballOnPaddle;
	
	public Paddle( int x, int y, int speed) {
		super(STANDARD_PADDLE_HEIGHT, STANDARD_PADDLE_WIDTH, x, y, speed, false);
	}

	@Override
	public void move() {
		// moves horizontally only
		//setX(getX()+5);
		setX(getX() + ((int)Math.sin(Math.toRadians(getAngle())) * getSpeed()));
		
		if (ballOnPaddle != null){
			ballOnPaddle.setX(getX()+OFFSET_BALL_PADDLE);
		}
	}


	public Ball getBallOnPaddle() {
		return ballOnPaddle;
	}

	public void setBallOnPaddle(Ball ballOnPaddle) {
		this.ballOnPaddle = ballOnPaddle;
	}

}
